package cz.martindobias.aladin;

import android.graphics.Bitmap;

public class ReverseImageListViewAdapter implements ImageListViewAdapter {
    private ImageListViewAdapter adapter;

    public ReverseImageListViewAdapter(ImageListViewAdapter adapter) {
        this.adapter = adapter;
    }

    public int getImageCount() {
        return this.adapter.getImageCount();
    }

    public Bitmap getBitmap(int index) {
        return this.adapter.getBitmap(this.getImageCount() - 1 - index);
    }

    public void setOnChangeListener(final OnChangeListener listener) {
        this.adapter.setOnChangeListener(new OnChangeListener() {
            public void onChange(int index) {
                listener.onChange(index == -1 ? index : ReverseImageListViewAdapter.this.getImageCount() - 1 - index);
            }
        });
    }
}
